﻿/*******************************************************************
 *  Copyright(c) 2018-2018 A single spark
 *  All rights reserved.
 *
 *  文件名称:yuvcenterwidget.cpp
 *  简要描述:主界面的centerWidgt控件
 *
 *  修改日期:  2018.03.06
 *  作者:      LD
 *  邮箱:
 *  说明:
 *
 *  修改日期:
 *  作者:
 *  邮箱:
 *  说明:
 ******************************************************************/
#include "yuvcenterwidget.h"
#include "yuvvideolistwidget.h"
#include "yuvvideoplaywidget.h"
#include "yuvstatusbar.h"
#include "define.h"

#include <QHBoxLayout>
#include <QVBoxLayout>

YUVCenterWidget::YUVCenterWidget(QWidget *parent)
    : YUVWidget(parent),
      m_pVideoListWidget(Q_NULLPTR),
      m_pVideoPlayWidget(Q_NULLPTR),
      m_pHLayoutTop(Q_NULLPTR)
{
    m_pVideoListWidget = new YUVVideoListWidget(this);
    m_pVideoPlayWidget = new YUVVideoPlayWidget(this);

    //set fixed size
    m_pVideoListWidget->setFixedSize(YUVTool::VideoListFixedWidth,
                                     YUVTool::VideoListFixedHeight);

    m_pVideoPlayWidget->setFixedSize(YUVTool::VideoPlayFixedWidth,
                                     YUVTool::VideoPlayFixedHeight);

    connect(m_pVideoListWidget, &YUVVideoListWidget::currentNameChanged,
            m_pVideoPlayWidget, &YUVVideoPlayWidget::resetFilePath);

    m_pStatusBar = new YuvStatusBar(this);

    //add layout
    m_pHLayoutTop = new QHBoxLayout();

    m_pVLayout = new QVBoxLayout(this);

    m_pHLayoutTop->addWidget(m_pVideoListWidget);
    m_pHLayoutTop->addWidget(m_pVideoPlayWidget);

    m_pVLayout->addLayout(m_pHLayoutTop);
    m_pVLayout->addWidget(m_pStatusBar);
    setLayout(m_pVLayout);

//    setStyleSheet("YUVCenterWidget YUVWidget{background: white;}");
}

YUVCenterWidget::~YUVCenterWidget()
{

}
